

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page session="true" import="servlets.*" %>
<%@ page session="true" import="classes.*" %>
<%@ page session="true" import="beans.*" %>
<%@page import="java.util.List"%>

 <%  	session = request.getSession(true); %>
<%@ page session="true" import="dbclass.*" %> 
<%@ page session="true" import="java.sql.ResultSet" %>
<% CategoriaDAO catmenu = new CategoriaJDBC(); %>


    <div id="sidebar" class="dbx-group"> 
      <div class="dbx-box" id="block-forum"> 
        <h3 style="cursor: pointer;" class="dbx-handle">Not&iacute;cias</h3> 
        <div class="dbx-content"> 
          <div class="item-list"> 
            <ul> 
            	<li><strong><a href="Home">Todas</a></strong></li>
            <%  ResultSet rs = catmenu.findTotal(); %>
            <% while(rs.next()){ 
            		if(rs.getInt("total") != 0){
            			out.print("<li><a href=\"Home?id="+rs.getLong("id")+"\">"+rs.getString("nome")+"</a> ("+rs.getInt("total")+")</li>");
            		}
               } 
            %>
			 

            </ul> 
          </div> 
        </div>  
      </div> 
      
      <% if(session.getValue("autor_login") != null) { %>
      <div class="dbx-box" id="block-forum"> 
        <h3 style="cursor: pointer;" class="dbx-handle">Administra&ccedil;&atilde;o</h3> 
        
        <div class="dbx-content">  
          <div class="item-list"> 
          
          Logado como <strong> 
          <%
          out.print(session.getValue("nome_autor")); 
          %></strong>
       
            <ul> 
			  <li><a id="id_noticia" href="Noticias">Gerenciar Not&iacute;cias</a></li> 
			  <li><a href="Categorias">Gerenciar Categorias</a></li> 
			  <li><a href="Videos">Gerenciar V&iacute;deos</a></li> 
			  <li><a href="Imagens" id="id_image">Gerenciar Imagens</a></li> 
			  <li><a href="Autores">Gerenciar Autores</a></li>  
			  <li><a href="Logout" style="color:#666666">Logout</a></li> 
		    </ul> 
          </div> 
        </div> 
      </div> 
      <% } %>
      <% if(session.getValue("autor_login") == null) { %>
      
      <div class="dbx-box" id="block-blog"> 
        <h3 style="cursor: pointer;" class="dbx-handle">Login no Sistema</h3> 
        <div class="dbx-content"> 
          <div class="item-list">
          	<form action="Login" method="POST">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>
                <label> Login:<br />
                    <input type="text" name="login" id="textfield" />
                </label>
                
                </td>
              </tr>
              <tr>
                <td>
                <label> Senha:<br />
                    <input type="password" name="senha" id="textfield" />
                </label>
                 
                <input type="submit" name="button" id="button" value="&raquo;" style="padding:0px 2px 0px 2px" /></td>
              </tr>
              <tr>
                <td style="padding-top:4px;"><label>
                  
                <div align="left"></div>
                </label></td>
              </tr>
            </table>
            </form>
          </div> 
          <% }  %>

  
      <div class="dbx-box" id="block-blog"> 
        <h3 style="cursor: pointer;" class="dbx-handle">Busca Ajax</h3> 
        <div class="dbx-content"> 
          <div class="item-list">

            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>
                <label> Busca:<br />
                    <input type="text" name="login" id="ajax_palavra" onkeyup="busca(this.value)" style="width:120px" />
                </label>
                
                </td>
              </tr>


            </table>
            <div id="ajax_div">
            	Digite a palavra acima 	
            </div>
          </div>  
        </div> 
      </div>
        
      <div class="dbx-box" id="block-blog"> 
        <h3 style="cursor: pointer;" class="dbx-handle">Ultimas Noticias</h3> 
        <div class="dbx-content"> 
          <div class="item-list">

            <div id="div_comet"> 
	            <ul> 
	            <% NoticiaDAO notdao = new NoticiaJDBC(); %>
	            <%  List<Noticia> noticiasss  = (List<Noticia>) notdao.findAll(); %>
				<% for(int i = 0; i < noticiasss.size() && i < 5; i++) {
					Noticia noticiaaa = (Noticia)noticiasss.get(i);  
					%>
				  <li><a href="NoticiasVer?id=<%  out.print(noticiaaa.getId()); %>"><%  out.print(noticiaaa.getTitulo()); %></a></li> 
			    <% } %>
			    
			    </ul>
            </div>
          </div>  
        </div> 
      </div>
      